package linkedlist;

import linkedlist.create.LoopLinkedCreator;
import linkedlist.delete.LoopDeletor;
import linkedlist.iterator.LoopIterator;
import linkedlist.reverse.LoopReverse;

import java.util.Arrays;

/**
 * @Author wangtengyu
 * @Create 2018-09-03-14:41
 */
public class LoopDemo {

  public static void main(String[] args) {
    LoopLinkedCreator creator = new LoopLinkedCreator();
    LoopIterator iterator = new LoopIterator();
    LoopDeletor deletor = new LoopDeletor();
    LoopReverse reverser = new LoopReverse();

    System.out.println("遍历链表");
    Node node = creator.createlinkedList(Arrays.asList(3, 4, 2, 5, 2, 2));
    iterator.iterator(node);
    System.out.println();

    System.out.println("反转链表");
    node = reverser.reverseLinkedList(node);
    iterator.iterator(node);
    System.out.println();

    System.out.println("删除集合中的元素2之后");
    node = deletor.deleteValue(node, 2);
    iterator.iterator(node);
  }
}
